{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">网站概览</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <fieldset class="layui-elem-field">
                    <legend>站点状态</legend>
                    <div class="layui-field-box">
                        <form class="layui-form" >
                            <div class="layui-form-item">
                                <label class="layui-form-label">开关</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" lay-filter="status" name="switch" lay-skin="switch" lay-text="开启|关闭" {if condition="$site_status==1"}checked{/if}>
                                </div>
                            </div>
                        </form>
                    </div>
                </fieldset>
                <table class="layui-table">
                    <tr>
                        <td style="width: 400px;">网站域名</td>
                        <td>{$config.url}</td>
                    </tr>
                    <tr>
                        <td>网站目录</td>
                        <td>{$config.document_root}</td>
                    </tr>
                    <tr>
                        <td>服务器操作系统</td>
                        <td>{$config.server_os}</td>
                    </tr>
                    <tr>
                        <td>服务器端口</td>
                        <td>{$config.server_port}</td>
                    </tr>
                    <tr>
                        <td>服务器环境</td>
                        <td>{$config.server_soft}</td>
                    </tr>
                    <tr>
                        <td>PHP版本</td>
                        <td>{$config.php_version}</td>
                    </tr>
                    <tr>
                        <td>MySQL版本</td>
                        <td>{$config.mysql_version}</td>
                    </tr>
                    <tr>
                        <td>最大上传限制</td>
                        <td>{$config.max_upload_size}</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    form.on('switch(status)', function(data){
        // console.log(data.elem); //得到checkbox原始DOM对象
        // console.log(data.elem.checked); //开关是否开启，true或者false
        // console.log(data.value); //开关value值，也可以通过data.elem.value得到
        // console.log(data.othis); //得到美化后的DOM对象

        $.post('{:url("admin/index/changeSiteStatus")}',{state:data.elem.checked},function(res){
            layer.msg(res.msg);
        },'json');
    });
</script>
{/block}
